<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('角色列表')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
		  <div class="col-sm-12 search-collapse">
				<form id="role-form">
					<div class="select-list">
						<ul>
							<li>
								活动名称：<input type="text" name="actName"/>
							</li>
							<li>
								是否有效：<select name="isValid" th:with="type=${@dict.getType('sys_normal_disable')}">
									<option th:value="3">所有</option>
									<option th:value="0">无效</option>
									<option th:value="1">有效</option>
								</select>
							</li>
							<li class="select-time">
								<label>活动时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		
		var prefix = ctx + "activity";
		
		$(function() {
		    var options = {
		        url: prefix + "/list",
		        sortName: "actId",
		        modalName: "活动",
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'actName',
		            title: '活动名称'
		        },
		        {
		            field: 'actType',
		            title: '活动类型',
		            sortable: true,
		            formatter: function (value, row, index) {
		        		if(value=="1"){
		        			return "1元购水";
		        		}else if(value=="2"){
		        			return "1元捐水";
		        		}
		        		else if(value=="3"){
		        			return "XX元购票";
		        		}
		        	}
		        },
		        {
		            field: 'startTime',
		            title: '活动开始时间',
		            sortable: true
		        },
		        {
		            field: 'endTime',
		            title: '活动结束时间',
		            sortable: true
		        },
		        {
		            field: 'num',
		            title: '活动人数',
		            sortable: true
		        },{
		            field: 'isValid',
		            title: '是否有效',
		            formatter: function (value, row, index) {
		        		if(value=="0"){
		        			return "无效";
		        		}else if(value=="1"){
		        			return "有效";
		        		}
		        	}
		        },
		        {
		            field: 'price',
		            title: '单价',
		            sortable: true
		        },
		        {
		            field: 'voucher',
		            title: '代金券',
		            sortable: true
		        },
		        {
		            field: 'amount',
		            title: '购买金额',
		            sortable: true
		        }]
		    };
		    $.table.init(options);
		});
			

		
	</script>
</body>
</html>